// electron-main/index.ts
import {app, BrowserWindow,dialog,ipcMain} from "electron"
import path from "path"

const createWindow = () => {
    const win = new BrowserWindow({
        webPreferences: {
            preload: path.join(__dirname, "./preload.js"), // 需要引用js文件
        },
        autoHideMenuBar: true,
        height:400,
        width:600,
        icon:'src/assets/favicon.ico'
    })
    win.loadURL('http://localhost:5173')
}
app.whenReady().then(() => {
    createWindow() // 创建窗口
})
ipcMain.handle('showNameDialog',async ()=>{
    const result = await dialog.showMessageBox({
        title:'你还未实名',
        message:'检测到你还未实名，暂不能使用本软件，你是否要去实名？',
        type:'info',
        buttons:['确定','取消'],
    })
    console.log(result)
    return result.response
})